/* components.css - 组件样式 */

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--color-primary);
  opacity: 0.9;
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: var(--color-dark);
}

.btn-secondary:hover {
  background-color: var(--color-secondary);
  opacity: 0.9;
}

.btn-accent {
  background-color: var(--color-accent);
  color: white;
}

.btn-danger {
  background-color: var(--color-danger);
  color: white;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1.125rem;
}

.btn-rounded {
  border-radius: var(--radius-full);
}

/* 卡片 */
.card {
  background-color: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* 产品卡片 */
.product-card {
  background-color: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all 0.3s ease;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.product-card__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-card__content {
  padding: 1rem;
}

.product-card__title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-card__description {
  color: var(--color-dark);
  opacity: 0.8;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-card__price {
  font-weight: 600;
  color: var(--color-primary);
}

/* 表单元素 */
.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-dark);
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  border-color: var(--color-primary);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(45, 106, 79, 0.25);
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* 图标装饰 */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
}

.icon-lg {
  width: 2rem;
  height: 2rem;
}

.icon-circle {
  border-radius: 50%;
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  color: white;
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
}

.badge-success {
  background-color: var(--color-success);
}

.badge-warning {
  background-color: var(--color-warning);
}

.badge-danger {
  background-color: var(--color-danger);
}

.badge-accent {
  background-color: var(--color-accent);
}

/* 折叠面板 */
.collapsible-content {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}

.collapsible-content.collapsed {
  max-height: 0;
}

/* 触摸优化 */
.touch-target {
  position: relative;
}

.touch-target::after {
  content: "";
  position: absolute;
  top: -10px;
  right: -10px;
  bottom: -10px;
  left: -10px;
  z-index: 0;
}

/* 通知 */
.notification {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background-color: var(--color-dark);
  color: white;
  padding: 1rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90%;
}

.notification.show {
  transform: translateY(0);
  opacity: 1;
}

.notification__icon {
  margin-right: 0.5rem;
}

/* 导航栏 */
.navbar {
  background-color: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.navbar__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
}

.navbar__logo {
  display: flex;
  align-items: center;
}

.navbar__logo-icon {
  font-size: 1.5rem;
  color: var(--color-accent);
  margin-right: 0.5rem;
}

.navbar__menu {
  display: flex;
  gap: 1.5rem;
}

.navbar__item {
  color: white;
  text-decoration: none;
  transition: color 0.2s;
}

.navbar__item:hover {
  color: var(--color-secondary);
}

.navbar__item--active {
  color: var(--color-accent);
  font-weight: 500;
}

.mobile-navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: white;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
  display: flex;
  justify-content: space-around;
  z-index: 50;
}

.mobile-navbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  color: var(--color-dark);
  text-decoration: none;
}

.mobile-navbar__item--active {
  color: var(--color-primary);
}

.mobile-navbar__icon {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.mobile-navbar__label {
  font-size: 0.75rem;
}
